<template>
	<view>
		<view class="commonImageBox">
			<view class="commonImageBoxLeft">{{ name }}: </view>
			<view class="imageBoxF">
				<view class="imageBox" v-for="(item, index) in imageList" :key="index">
					<image @click="see(item)" class="commonImageBoxRight" :src="item.filePath" v-if="item" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { preView } from '../utils/util';
export default {
	name: "commonImage",
	props: {
		name: {
			default: '',
			type: String
		},
		value: {
			default: '',
			type: String
		}
	},
	data() {
		return {
		};
	},
	computed: {
		imageList() {
			if (this.value) {
				return JSON.parse(this.value)
			}
			return []
		}
	},
	methods: {
		see(item) {
			preView(item.filePath, 'image', '')
		}
	}
}
</script>

<style lang="scss" scoped>
.commonImageBox {
	margin-top: 10rpx;

	.commonImageBoxLeft {
		font-size: 25rpx;
		font-weight: 800;
	}

	.imageBox {
		width: 151rpx;
		height: 151rpx;
		background: #DADADA;
		border-radius: 7rpx 7rpx 7rpx 7rpx;
		opacity: 1;
		border: 0rpx solid #FFFFFF;
		position: relative;
		z-index: 1;
		margin-right: 20rpx;
		margin-top: 15rpx;
		margin-bottom: 17.5rpx;

		.commonImageBoxRight {
			width: 151rpx;
			height: 151rpx;
			border-radius: 7rpx 7rpx 7rpx 7rpx;
		}

	}

	.imageBoxF {
		display: flex;
		flex-wrap: wrap;
		padding-right: 20rpx;
	}
}
</style>